import time

def sort_file(filename):
    f = open(filename) 
    soderj = [int(el.strip()) for el in f.readlines()]
    f.close() 
    start = time.time() 
    for i in range(len(soderj) - 1) :
        for j in range(len(soderj) - 1 - i) :
            if soderj[j] > soderj[j + 1]:
                soderj[j], soderj[j + 1] = soderj[j + 1], soderj[j]
    finish = time.time() 
    a = (round(finish - start) * 1000) 
    print(filename[:-4], a, 'milliseconds')
    
sort_file('m1_sorted.txt')
sort_file('m2_reverse.txt')
sort_file('m3_shuffle.txt')